import 'dart:convert';
import 'package:convert/convert.dart';
import 'package:crypto/crypto.dart';
import 'package:flutter/material.dart';
import 'package:fluttertoast/fluttertoast.dart';


class ToolUtil {
  static String generateMD5(String data) 
  {
    var content = new Utf8Encoder().convert(data);
    var digest = md5.convert(content);
     //这里其实就是digest.toString() 
    return hex.encode(digest.bytes);
   }

   static void showToast(String msg) {
    Fluttertoast.showToast(
        msg: msg,
        toastLength: Toast.LENGTH_SHORT,
        gravity: ToastGravity.BOTTOM,
        timeInSecForIos: 1,
        backgroundColor: Colors.black45,
        textColor: Colors.white,
        fontSize: 16.0
    );
  }

}
